package com.smart.tool.extension.model;

import java.util.Set;

/**
 * 扩展点封装类
 */
public class ExtensionOperation {

    private String sence;


    private String useCase;

    private int order;

    private Class<?> clazz;

    private Set<Class<?>> interfaceClasses;

    private Set<Class<?>> superClasses;

    private Object iExtension;

    public Object getiExtension() {
        return iExtension;
    }

    public void setiExtension(Object iExtension) {
        this.iExtension = iExtension;
    }

    public void setIExtension(Object iExtension) {
        this.iExtension = iExtension;
    }

    public Set<Class<?>> getInterfaceClasses() {
        return interfaceClasses;
    }
    public void setInterfaceClasses(Set<Class<?>> interfaceClasses) {
        this.interfaceClasses = interfaceClasses;
    }
    public Set<Class<?>> getSuperClasses() {
        return superClasses;
    }
    public void setSuperClasses(Set<Class<?>> superClasses) {
        this.superClasses = superClasses;
    }


    public String getSence() {
        return sence;
    }

    public void setSence(String sence) {
        this.sence = sence;
    }

    public String getUseCase() {
        return useCase;
    }

    public void setUseCase(String useCase) {
        this.useCase = useCase;
    }


    public Class<?> getClazz() {
        return clazz;
    }

    public void setClazz(Class<?> clazz) {
        this.clazz = clazz;
    }

    public int getOrder() {
        return order;
    }

    public void setOrder(int order) {
        this.order = order;
    }

    public String uniqueUseCaseKey() {
        return sence + "_" + useCase+"_"+order;
    }

    public String uniqueSenceKey() {
        return clazz.getName() + "_" + sence;
    }

    public boolean filterOperation(Class clazz){
        if(clazz.equals(this.clazz)){
            return true;
        }
        if(interfaceClasses.contains(clazz)){
            return true;
        }
        if(superClasses.contains(clazz)){
            return true;
        }
        return false;
    }
}
